package com.zdf.license.web.config;

import com.zdf.license.web.controller.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public AjaxResult<?> bizExceptionHandler(HttpServletRequest request, Exception e){
        return AjaxResult.error(e.getMessage());
    }

}
